function countReducer(state = 0, action) {
  const { type, payload } = action;
  switch (type) {
    case "add":
      return (state = state + payload);
    case "subtract": 
      return (state = state - payload);
    default:
      return state;
  }
}

export default countReducer;
